package com.jy.rhin.config;

import com.alibaba.nacos.spring.context.annotation.config.NacosRefresh;
import com.jy.api.okhttp.QyjkHealthdcClient;
import com.jy.api.patient.PatientAPI;
import com.jy.api.patient.PatientAPIv1Impl;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @author Alen
 * @date 2024/8/7 11:10
 * @since 2024/8/7 11:10
 */
@Slf4j
@Getter
@Setter
@Component
@NacosRefresh
@Configuration
@ConfigurationProperties(prefix = "com.cowinhealth.empi")
public class EmpiConfig {
    private Url url;
    @Getter
    @Setter
    public static class Url {
        /**
         * 病人索引关系URL
         */
        private String patientIndex;
        /**
         * 病人详细信息URL
         */
        private String patientInfo;
        /**
         *患者添加或者更新URL
         */
        private String patientInsertOrUpdatePath;
        /**
         *分页获取居民信息地址
         */
        private String patientPageQueryPath;

        /**
         * 查询交叉索引地址
         */
        private String identifierQueryPath;

        /**
         * 通过身份证查询患者信息地址
         */
        private String patientQueryByIdCardPath;
    }
    @Bean
    @ConditionalOnMissingBean
    public PatientAPI patientAPIv1(QyjkHealthdcClient client){
        return new PatientAPIv1Impl(client);
    }
}
